#!/bin/sh
module="test_drv"
device="test_dev"
mode="664"
group="david"


# remove stale nodes
rm -f /dev/${device} 

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
/sbin/insmod -f ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$device\" {print \\$1}"`

mknod /dev/${device} c $major 0

# give appropriate group/permissions
chgrp $group /dev/${device}
chmod $mode  /dev/${device}
